﻿@page "/"
@namespace LaserMark.Components.Pages
@inherits EventViewBaseComponent
@inject DialogService DialogService
@inject IControl Control
@inject IPrint Print
@inject IStringLocalizer<Home> Localizer

<Header>
</Header>

<div class="main">
    <div class="main-header">
        @Localizer["Origin"]：@CurrentOriginalIndex/@Info.OriginalCount @Localizer["Price"] @Localizer["LayoutOrder"]：@CurrentOriginalIndex/@Info.OriginalCount @Localizer["Price"] @Localizer["Price"] @Localizer["LeftTrim"]：@CurrentOriginal.TrimLeft mm @Localizer["RightTrim"]：@CurrentOriginal.TrimRight mm @Localizer["TopTrim"]：@CurrentOriginal.TrimTop mm @Localizer["Height"]：@CurrentOriginal.Thickness mm
    </div>
    <div class="main-container">
        <div class="main-left">
            <div class="main-body">
                <div class="main-body-left">
                    @* <div class="row g-1">
                    <div class="col-3">
                    <Button Text="@Localizer["ClearButton"]" OnClick="ClearStatus"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["AllLayout"]"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["ClearMark"]"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["ReOptimize"]"></Button>
                    </div>
                    </div>
                    <div class="row g-1">
                    <div class="col-3">
                    <Button Text="@Localizer["XImage"]"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["YImage"]"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["XImageAll"]"></Button>
                    </div>
                    <div class="col-3">
                    <Button Text="@Localizer["YImageAll"]"></Button>
                    </div>
                    </div> *@

                    <div class="row form-inline mt-1">
                        <div class="col-12 align-self-center">
                            @Localizer["Name"]： @Info.FileName
                        </div>
                    </div>

                    <Table class="mt-1" TItem="Template" Items="Items" IsBordered="true" IsStriped="true" ShowDefaultButtons="false" IsFixedHeader="true" @ref="Table">
                        <TableColumns>
                            <TableColumn @bind-Field="context.VersionOrder" Text="@Localizer["LayoutOrder"]" Align="Alignment.Center" Width="45"></TableColumn>
                            <TableColumn @bind-Field="context.Specification" Text="@Localizer["Type"]" Align="Alignment.Center" TextEllipsis="true" ShowLabelTooltip="true" Width="120"></TableColumn>
                            <TableColumn @bind-Field="context.SliceOrder" Text="@Localizer["SliceOrder"]" Align="Alignment.Center" Width="85">
                                <Template Context="column">
                                    @if (column.Row.Status == Status.Printting)
                                    {
                                        <span>@CurrentPieceIndex/@column.Value</span>
                                    }
                                    else
                                    {
                                        <span>@column.Value</span>
                                    }
                                </Template>
                            </TableColumn>
                            <TableColumn @bind-Field="context.Status" Text="@Localizer["Status"]" Align="Alignment.Center">
                                <Template Context="column">
                                    @if (column.Value == Status.NoPrint)
                                    {
                                        <span>@column.Value.ToDescriptionString()</span>
                                    }
                                    else
                                    {
                                        <span class="text-danger">@column.Value.ToDescriptionString()</span>
                                    }
                                </Template>
                            </TableColumn>
                            <TableColumn @bind-Field="context.MaterialQuality" Text="@Localizer["Material"]"></TableColumn>
                        </TableColumns>
                    </Table>
                </div>
                <div class="main-body-right">
                    <div style="height: 100%;width: 100%;opacity: 0;position: absolute;z-index: 100;"></div>
                    @if (IsShow)
                    {
                        <SvgEditor PreContent="@Content" @ref="SvgEditor"></SvgEditor>
                    }
                </div>
            </div>
        </div>
        <div class="main-right">
            <Speed></Speed>
            <AxisStatus></AxisStatus>
            <DeviceStatus></DeviceStatus>
            <AxisJog Original="@CurrentOriginal"></AxisJog>
        </div>
    </div>
</div>
<div class="main-footer">
    <div class="footer-item"></div>
    @if (Info.Originals != null)
    {
        foreach (var item in Info.Originals)
        {
            <div class="@ClassString(item)" @key="item" @onclick="() => OnClick(item)"></div>
        }
    }
</div>
<Monitor></Monitor>
